<?php

/**
 * This is the model class for table "gs_verify".
 *
 * The followings are the available columns in table 'gs_verify':
 * @property integer $id
 * @property string $verify_code
 * @property string $app_id
 * @property string $bundle_id
 * @property string $price
 * @property string $receipt
 */
class Verify extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Verify the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'gs_verify';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('bundle_id', 'required'),
			array('app_id, bundle_id, price', 'length', 'max'=>255),
			array('verify_code, receipt', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('id, verify_code, app_id, bundle_id, price, receipt', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'id' => 'ID',
			'verify_code' => 'Verify Code',
			'app_id' => 'App',
			'bundle_id' => 'Bundle',
			'price' => 'Price',
			'receipt' => 'Receipt',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('id',$this->id);
		$criteria->compare('verify_code',$this->verify_code,true);
		$criteria->compare('app_id',$this->app_id,true);
		$criteria->compare('bundle_id',$this->bundle_id,true);
		$criteria->compare('price',$this->price,true);
		$criteria->compare('receipt',$this->receipt,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}